home *** CD-ROM | disk | FTP | other *** search
- Path: news.uiowa.edu!usenet
- From: larued@crpl.cedar-rapids.lib.ia@crpl.cedar-rapids.lib.ia.us
- Newsgroups: comp.lang.c++
- Subject: Re: who know how to use large array in c++?
- Date: 23 Jan 1996 08:10:13 GMT
- Organization: University of Iowa, Iowa City, IA, USA
- Distribution: world
- Message-ID: <4e2555$ro6@flood.weeg.uiowa.edu>
- References: <4e0ml0$jt5@mercury.wright.edu>
- Reply-To: larued@crpl.cedar-rapids.lib.ia@crpl.cedar-rapids.lib.ia.us
- NNTP-Posting-Host: ppp-101.cedar-rapids.lib.ia.us
- X-Newsreader: IBM NewsReader/2 v1.9d - NLS
-
- In <4e0ml0$jt5@mercury.wright.edu>, Apichart Intarapanich <aintara> writes:
- >hi
- >anybody know how can i declare array like this
- >
- >float a[1000][1000][1000];
- >
- >i cannot do that. i got segmentation fault statement. who know what should i
- >do?
- >apichart
- >
-
- Apichart,
-
- This is a problem related to system architecture and limitations of your
- compiler.
-
- Think about what you are asking the computer to do.
- What is 1000 * 1000 * 1000 * sizeof (float)? My guess would be 4GB.
-
- This compiles just fine on my IBM C Set/2 (OS/2) machine. It does not on
- a DOS machine because their is a 64KB limit to any specific structure. This
- does not mean that OS/2 runs such an application. No matter how I write
- such a program, it will attempt to allocate a 4GB stack. That won't happen
- on my 5.5GB system, whose swapper cannot exceed my partition size of 1GB.
-
- You could allocate several large files and create accessors to the files
- to simulate such a large structure. My guess is that their is a better
- way of structuring your problem so that it does not use such a large array.
-
- Hope this helps,
-
- Dave LaRue
-